package com.gz.thread.runnable;

// 静态代理
public class StaticProxy {
    public static void main(String[] args) {
        Bank bank = new Bank(new People());
        bank.saveMoney();
    }
}



interface SaveMoney{
     void saveMoney();
}


class People implements SaveMoney{

    public void saveMoney() {
        System.out.println("存钱。。。。。");
    }
}

class Bank implements SaveMoney{

    private SaveMoney saveMoney;

    Bank(SaveMoney saveMoney){
        this.saveMoney = saveMoney;
    }

    public void saveMoney() {
        before();
        saveMoney.saveMoney();
        after();
    }

    private void after() {
        System.out.println("打入账户");
    }

    private void before() {
        System.out.println("登记信息");
    }
}